#!/bin/bash
#安装软件

#nginx
nginx_name=nginx-1.13.5 #nginx版本
#安装必要软件
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

wget -c https://nginx.org/download/${nginx_name}.tar.gz

tar -zxvf ${nginx_name}.tar.gz

cd ${nginx_name}

if [ ! -f /opt/nginx ];then
        mkdir -p /opt/nginx
fi

#./configure 
./configure \
--prefix=/opt/nginx

make && make install

#启动nginx
cd /opt/nginx/sbin/
./nginx
cd
#开机自启动
echo "/opt/nginx/sbin/nginx" >> /etc/rc.local
chmod 755 /etc/rc.local

#mysql5.6
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server

#jdk1.8
cd /opt/
wget http://jjbig.jb51.net:8080/201704/tools/jdk-linux-x64.tar.gz && tar -xzvf jdk-linux-x64.tar.gz
mv jdk1.8.0_131 jdk1.8 && cd jdk1.8
path=`pwd`
echo "export JAVA_HOME=${path}
export PATH=$PATH:$JAVA_HOME/bin" >> /etc/profile
source /etc/profile

#tomcat8 apr
yum install apr-devel
yum install openssl-devel
yum install gcc
yum install make

tar -zvxf apache-tomcat-8.0.47.tar.gz && cd apache-tomcat-8.0.47/bin
tar -zxvf tomcat-native.tar.gz && cd tomcat-native-1.2.14-src/native
./configure && make && make install

#其中路径为自定义
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
export LD_RUN_PATH=$LD_RUN_PATH:/usr/local/apr/lib
sed -i '69s/HTTP\/1.1/org.apache.coyote.http11.Http11AprProtocol/g' tomcat路径
